package com.eunion.core.common.domain;

import java.io.Serializable;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.Size;

import org.hibernate.annotations.GenericGenerator;

@MappedSuperclass
public abstract class AbstractOracleIdxObject implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 逻辑主键
     */
    @Size(max = 32)
    @Id
    @GenericGenerator(name = "common-guid", strategy = "uuid")
    @GeneratedValue(generator = "common-guid")
    private String idx;

    public String getIdx() {
        return idx;
    }

    public void setIdx(String idx) {
        this.idx = idx;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((idx == null) ? 0 : idx.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        AbstractOracleIdxObject other = (AbstractOracleIdxObject) obj;
        if (idx == null) {
            if (other.idx != null)
                return false;
        } else if (!idx.equals(other.idx))
            return false;
        return true;
    }
}
